package intelligentcity.model.streets;

import java.util.LinkedList;
import java.util.List;

import intelligentcity.conf.Conf;
import intelligentcity.model.Point;
import intelligentcity.model.Road;

public abstract class Street extends Road {

    protected OneWayStreet firstStreet;
    protected OneWayStreet secondStreet;
    protected int firstStreetImportance;
    protected int secondStreetImportance;

    public Street(OneWayStreet firstStreet, OneWayStreet secondStreet, int firstStreetImportance,
            int secondStreetImportance) {
        super();
        this.firstStreet = firstStreet;
        this.secondStreet = secondStreet;
        this.firstStreetImportance = firstStreetImportance;
        this.secondStreetImportance = secondStreetImportance;
    }

    public Street(OneWayStreet firstStreet, OneWayStreet secondStreet, int streetImportance) {
        this(firstStreet, secondStreet, streetImportance, streetImportance);
    }

    public Street(OneWayStreet firstStreet, OneWayStreet secondStreet) {
        this(firstStreet, secondStreet, Conf.defaultStreetImportance);
    }

    @Override
    public String toString() {
        return firstStreet.toString() + "---" + secondStreet.toString();
    }

    @Override
    public boolean equals(Object o) {
        if (o instanceof Street && ((Street) o).getFirstStreet().equals(firstStreet)
                && ((Street) o).getSecondStreet().equals(secondStreet)) {
            return true;
        }
        return false;
    }

    @Override
    public List<OneWayStreet> getOneWayStreets() {
        List<OneWayStreet> oneWayStreets = new LinkedList<>();
        oneWayStreets.add(firstStreet);
        oneWayStreets.add(secondStreet);
        return oneWayStreets;
    }

    @Override
    public List<Point> getPointsOfTurn() {
        return null;
    }

    public OneWayStreet getFirstStreet() {
        return firstStreet;
    }

    public OneWayStreet getSecondStreet() {
        return secondStreet;
    }

    public int getFirstStreetImportance() {
        return firstStreetImportance;
    }

    public int getSecondStreetImportance() {
        return secondStreetImportance;
    }

}
